-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade original targets #2942
Upgrade original targets #2942
Conversation
// Less returns true if this build label would sort less than another one. | ||
func (label BuildLabel) Less(other BuildLabel) bool { | ||
if label.PackageName == other.PackageName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm restructuring this a bit but also it was wrong for ages because it didn't look at subrepos.
@@ -59,7 +59,8 @@ func TestExpandVisibleOriginalTargets(t *testing.T) { | |||
|
|||
func TestExpandOriginalSubLabels(t *testing.T) { | |||
state := NewDefaultBuildState() | |||
state.AddOriginalTarget(BuildLabel{PackageName: "src/core", Name: "..."}, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we ever actually needed to support this. The new implementation just panics but things like plz test //...
are still fine - those are turned into a sequence of :all
targets elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! Maybe we can try this out.
ChangeLog
Outdated
@@ -11,6 +11,7 @@ Version 17.4.0 | |||
* Add all commit date formats to supported git_show() format verbs (#2930) | |||
* Fix reduce builtin (#2925) | |||
* Fix issue with completing idents in the language server (#2917) | |||
* Improve performance when a large number of input targets are supplied (#2942) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is a bit wonk here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
M-x untabify
src/core/state.go
Outdated
} | ||
return false | ||
return state.progress.originalTargets.Match(target.Label) && state.ShouldInclude(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic isn't quite right. I think what we want is:
func (state *BuildState) isOriginalTarget(target *BuildTarget, exactOnly bool) bool {
allTargetsMatch, exact := state.progress.originalTargets.Match(target.Label)
return exact || (!exactOnly && allTargetsMatch && state.ShouldInclude(target))
}
Currently if I have a test with labels = ["manual"]
and I match it exactly i.e. plz test //tests:manual
, then it will be excluded because it's not an exact match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow okay slowpoke
We've found cases where this can be notably slow when piping very large numbers of targets into plz. The code there is pretty old - when it was written we didn't have repos with hundreds of thousands of targets or remote execution with hundreds of workers, so we never really noticed.
This upgrades the implementation to be more efficient rather than running over a huge slice again and again.
I've tested using the profiler locally and things look much more sensible after this (i.e. not all the time is going into
OriginalTarget
functions any more)